<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function myAddEvent(obj,ev,fn){
            if(obj.attachEvent){
                obj.attachEvent('on'+ev,fn);
            }
            else{
                obj.addEventListener(ev,fn,false);
            }
        }
//        引用函数
        window.onload=function(){
          var oBtn=document.getElementById('btn1');
          myAddEvent(oBtn,'click',function(){
                alert('a');
          });
            myAddEvent(oBtn,'click',function(){
                alert('b');
            });
        };
    </script>
</head>
<body>
<input type="button" id="btn1" value="按钮">
</body>
</html>